package javaDemo06;

public class Dice {
    public static void main(String[] args) {
        Dice();
    }

    public static void Dice() {
        boolean c = true;
        while (c) {
            int a = (int) (Math.random() * 6 + 1);
            int b = (int) (Math.random() * 6 + 1);
            if (a + b == 2 || a + b == 3 || a + b == 12) {
                System.out.println("第一颗骰子为" + a);
                System.out.println("第二颗骰子为" + b);
                System.out.println("你输了");
                c = false;
            } else if (a + b == 7 || a + b == 11) {
                System.out.println("第一颗骰子为" + a);
                System.out.println("第二颗骰子为" + b);
                System.out.println("你赢了");
                c = false;
            } else {
                int test = a + b;
                System.out.println("第一颗骰子为" + a);
                System.out.println("第二颗骰子为" + b);
                System.out.println("point is " + test);
                boolean f = true;
                while (f) {
                    int e = (int) (Math.random() * 6 + 1);
                    int r = (int) (Math.random() * 6 + 1);
                    int test1 = e + r;
                    if (test == test1) {
                        System.out.println("第二轮开始");
                        System.out.println("第一颗骰子为" + e);
                        System.out.println("第二颗骰子为" + r);
                        System.out.println("你赢了");
                        f = false;
                    } else if (test1 == 7) {
                        System.out.println("第二轮开始");
                        System.out.println("第一颗骰子为" + e);
                        System.out.println("第二颗骰子为" + r);
                        System.out.println("你输了");
                        f = false;
                    }
                }
                c = false;
            }
        }
    }
}
